throw new MWException( 'Unable to determine appropriate JOIN condition for tagging.' );
}
- // JOIN on tag_summary
- $tables[] = 'tag_summary';
- $join_conds['tag_summary'] = array( 'LEFT JOIN', "ts_$join_cond=$join_cond" );
- $fields[] = 'ts_tags';
+ $fields['ts_tags'] = wfGetDB( DB_SLAVE )->buildGroupConcatField(
+ ',', 'change_tag', 'ct_tag', "ct_$join_cond=$join_cond"
+ );
if ( $wgUseTagFilter && $filter_tag ) {
// Somebody wants to filter on a tag.
return 'CONCAT(' . implode( ',', $stringList ) . ')';
}
+ /**
+ * Build a GROUP_CONCAT or equivalent statement for a query.
+ *
+ * This is useful for combining a field for several rows into a single string.
+ * NULL values will not appear in the output, duplicated values will appear,
+ * and the resulting delimiter-separated values have no defined sort order.
+ * Code using the results may need to use the PHP unique() or sort() methods.
+ *
+ * @param string $delim Glue to bind the results together
+ * @param string|array $table Table name
+ * @param string $field Field name
+ * @param string|array $conds Conditions
+ * @param string|array $join_conds Join conditions
+ * @return String SQL text
+ * @since 1.23
+ */
+ public function buildGroupConcatField(
+ $delim, $table, $field, $conds = '', $join_conds = array()
+ ) {
+ $fld = "GROUP_CONCAT($field SEPARATOR " . $this->addQuotes( $delim ) . ')';
+ return '(' . $this->selectSQLText( $table, $fld, $conds, null, array(), $join_conds ) . ')';
+ }
+
/**
* Change the current database
*
return $this->mServer;
}
+ public function buildGroupConcatField(
+ $delim, $table, $field, $conds = '', $join_conds = array()
+ ) {
+ $fld = "LISTAGG($field," . $this->addQuotes( $delim ) . ") WITHIN GROUP (ORDER BY $field)";
+ return '(' . $this->selectSQLText( $table, $fld, $conds, null, array(), $join_conds ) . ')';
+ }
+
public function getSearchEngine() {
return 'SearchOracle';
}
return implode( ' || ', $stringList );
}
+ public function buildGroupConcatField(
+ $delimiter, $table, $field, $conds = '', $options = array(), $join_conds = array()
+ ) {
+ $fld = "array_to_string(array_agg($field)," . $this->addQuotes( $delimiter ) . ')';
+ return '(' . $this->selectSQLText( $table, $fld, $conds, null, array(), $join_conds ) . ')';
+ }
+
public function getSearchEngine() {
return 'SearchPostgres';
}
return '(' . implode( ') || (', $stringList ) . ')';
}
+ public function buildGroupConcatField(
+ $delim, $table, $field, $conds = '', $join_conds = array()
+ ) {
+ $fld = "group_concat($field," . $this->addQuotes( $delim ) . ')';
+ return '(' . $this->selectSQLText( $table, $fld, $conds, null, array(), $join_conds ) . ')';
+ }
+
/**
* @throws MWException
* @param $oldName